<?php
require_once 'DB.php';
require_once 'Response.php';



$username = $_POST['username'];
$password = $_POST['pwd'];
//$password2=$_POST['password2'];
//$create_date=time()+(7*3600);
//$icon=$_POST['icon'];
//$file=$_FILES['icon'];
//move_uploaded_file($file['tmp_name'],'./uploads/'.$file['name']);
//$icon=$file['name'];

$pdo = DB::getInstance()->connect();
$sql="SELECT * FROM admin WHERE username='$username' ";
$stmt=$pdo->query($sql);


if($stmt->rowCount()>=1){
    Response::json('-1','换个名字老哥，这名字用过了');
}
else{

    $sql1="insert into admin(username,password)values('$username','$password')";
    $stmt=$pdo->query($sql1);
    Response::json('200','注册成功');
}







